import { post } from './index.js'
import { get } from './index.js'

// 得到商品中数据表
export const GetProductData = (body) => {
  return get('/productList', body).then(res => res.data)
}

// 得到商品表中的注释
export const GetProductDataName = (body) => {
  return get('/productListName', body).then(res => res.data)
}

// 得到分类
export const GetCategory = (body) => {
  return get('/getCategory', body).then(res => res.data)
}

// 增加商品
export const AddProduct = (body) => {
  return post('/addProduct', body).then(res => res.data)
}

// 修改商品
export const ChangeProduct = (body) => {
  return post('/changeProduct', body).then(res => res.data)
}

// 删除商品
export const DeleteProduct = (body) => {
  return post('/deleteProduct', body).then(res => res.data)
}

// 搜索商品，通过类别，或则商品名字
export const SearchProduct = (body) => {
  return post('/searchProduct', body).then(res => res.data)
}

// 获取类别的注释名
export const GetCategoryAnnotations = (body) => {
  return get('/getCategoryAnnotations', body).then(res => res.data)
}

// 增加类别
export const AddCategory = (body) => {
  return post('/addCategory', body).then(res => res.data)
}

// 修改类别
export const ChangeCategory = (body) => {
  return post('/changeCategory', body).then(res => res.data)
}

// 删除类别
export const DeleteCategory = (body) => {
  return post('/deleteCategory', body).then(res => res.data)
}

// 查找类别
export const SearchCategory = (body) => {
  return post('/searchCategory', body).then(res => res.data)
}

// // 改变商品的上下架，推荐
export const ChangeProductStatus = (body) => {
  return post('/changeProductStatus', body).then(res => res.data)
}

